/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EC;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author TrangNHIT
 */
@Entity
@Table(name = "tbAccounts")
@NamedQueries({
    @NamedQuery(name = "Accounts.findAll", query = "SELECT a FROM Accounts a"),
    @NamedQuery(name = "Accounts.findByAccountID", query = "SELECT a FROM Accounts a WHERE a.accountID = :accountID"),
    @NamedQuery(name = "Accounts.findByAccountEmail", query = "SELECT a FROM Accounts a WHERE a.accountEmail = :accountEmail"),
    @NamedQuery(name = "Accounts.findByAccountPassword", query = "SELECT a FROM Accounts a WHERE a.accountPassword = :accountPassword"),
    @NamedQuery(name = "Accounts.findByAccountIsLock", query = "SELECT a FROM Accounts a WHERE a.accountIsLock = :accountIsLock")})
public class Accounts implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Account_ID")
    private Integer accountID;
    @Basic(optional = false)
    @Column(name = "Account_Email")
    private String accountEmail;
    @Basic(optional = false)
    @Column(name = "Account_Password")
    private String accountPassword;
    @Basic(optional = false)
    @Column(name = "Account_IsLock")
    private boolean accountIsLock;
    @OneToMany(mappedBy = "accounts")
    private List<Feedbacks> feedbacksList;
    @JoinColumn(name = "Account_ID", referencedColumnName = "Account_ID", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Customers customers;

    public Accounts() {
    }

    public Accounts(Integer accountID) {
        this.accountID = accountID;
    }

    public Accounts(Integer accountID, String accountEmail, String accountPassword, boolean accountIsLock) {
        this.accountID = accountID;
        this.accountEmail = accountEmail;
        this.accountPassword = accountPassword;
        this.accountIsLock = accountIsLock;
    }

    public Integer getAccountID() {
        return accountID;
    }

    public void setAccountID(Integer accountID) {
        this.accountID = accountID;
    }

    public String getAccountEmail() {
        return accountEmail;
    }

    public void setAccountEmail(String accountEmail) {
        this.accountEmail = accountEmail;
    }

    public String getAccountPassword() {
        return accountPassword;
    }

    public void setAccountPassword(String accountPassword) {
        this.accountPassword = accountPassword;
    }

    public boolean getAccountIsLock() {
        return accountIsLock;
    }

    public void setAccountIsLock(boolean accountIsLock) {
        this.accountIsLock = accountIsLock;
    }

    public List<Feedbacks> getFeedbacksList() {
        return feedbacksList;
    }

    public void setFeedbacksList(List<Feedbacks> feedbacksList) {
        this.feedbacksList = feedbacksList;
    }

    public Customers getCustomers() {
        return customers;
    }

    public void setCustomers(Customers customers) {
        this.customers = customers;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (accountID != null ? accountID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Accounts)) {
            return false;
        }
        Accounts other = (Accounts) object;
        if ((this.accountID == null && other.accountID != null) || (this.accountID != null && !this.accountID.equals(other.accountID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EC.Accounts[accountID=" + accountID + "]";
    }

}
